<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>大牌欢聚日</title>
    <link rel="stylesheet" href="../../css/model.css">
    <link rel="stylesheet" href="../style/dphjr-1016/style.css">

</head>
<body>
    <div class="header"></div>
    <div class="main">
        <div class="top"></div>
        <div class="wrap">
            <div class="title-1">低价抢</div>
            <div class="container">
            </div>
            <div class="nav">
                <div class="title-1">大家电</div>
                <div class="title-1 cur">小家电</div>
            </div>
            <div class="container">
            </div>
            <div class="nav">
                    <div class="title-1 cur">大家电</div>
                    <div class="title-1">小家电</div>
                </div>
            <div class="container">
            </div>
        </div>
        <div class="back-top"></div>
    </div>
    <div class="footer"></div>
    <!-- templat start -->
    <script type="text/html" id="card-tpl">
        <img src="{{pic}}" alt="">
        <div>
            <p>{{name}}</p>                            
            <div>
                <span>原价:<del>{{price_on_tag}}元</del>&nbsp;&nbsp;</span><i>活动价: <span>{{discountPrice}}</span>元</i>
            </div>
            <span>立即购买</span>
        </div>
    </script>
    <script type="text/html" id="ctx-tpl">
        {{each $data}}
            <a class="card" target='_blank'></a>
        {{/each}}
    </script>
</body>
<script type="text/javascript" src="../../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="../../js/art-template.js"></script>
<script src="../../js/login.js"></script>
<script src="../../js/model.js"></script>
<script>
    // init start
    var WWW_URL = 'http://www.cjwsc.com';
    $(".header").topBox();
    $(".footer").footBox();
    // init end
    (function ($, template) {
        var info = [
            [129584,143922,131562,148070,148168,119588],
            [129550,129554,129569,129606,129743,98198,143898,144184,147318,108339,109654,109650,110949,110997,110976,109395,107899,107474,124718,100566,124796],
            [147040,93884,124536,86565,135265,147618,122221,111101,130529,135332,135094,143791,132171,109302,86700,141290,147970,147969]
        ]

        function getData(id, idx, index) {
            $.ajax({
                url: 'http://www.cjwsc.com/qcwdProduct/getProductByIds',
                data: {
                    ids: id,
                    business_type: 10,
                    client_type: 1
                },
                dataType: "jsonp",
                jsonp: 'jsonpcallback',
                success: function (res) {
                    var href = 'http://www.cjwsc.com/item/' + id + '.html';
                    res.msg[0].index = idx + 1;
                    res.msg[0].pic = res.msg[0].pic.replace('240_240', '800_800')
                    var element = index ? $('.container').eq(index).find('.card').eq(idx) : $('.card').eq(idx);
                    element.html(template('card-tpl', res.msg[0])).attr('href', href);
                    if (res.msg[0].stock_num == 0 || res.msg[0].status == 2) element.addClass('masker')
                        .removeAttr('href');
                }
            })
        }

        function setData(info){
            for(var i=0,len=info.length;i<len;i++){
                $('.container').eq(i).html(template('ctx-tpl',info[i]))
                for(var j=0,leng=info[i].length;j<leng;j++){
                    getData(info[i][j],j,i)
                }
            }
            $('.container').eq(0).find('.card').addClass('cur');
        }
        setData(info)

        $('.nav').on('click','.title-1',function(){
            var $this = $(this);
            $('html,body').animate({
                scrollTop: $('.nav').eq($this.index()).offset().top
            }, 500)
        })

        $('.back-top').on('click', function () {
            $('html,body').animate({
                scrollTop: 0
            }, 500)
        })
    })($, template)
</script>
</html>








